<?php
header('Content-Type: image/png');
header('Content-Disposition: attachment; filename=timeline.png;');
header("Content-Transfer-Encoding: binary");

//assume png at present.
$image_data = trim($_GET['image_data']);

$parts = explode(",", $image_data);

$bin_data = base64_decode($parts[count($parts)-1]);

header('Content-Length: '.strlen($bin_data));

echo $bin_data;
?>